<?php
namespace app\common\model;
use think\Model;

class FirmAccountModel extends Model{
    protected  $name = 'firm_account';
    protected  $pk   = 'firm_account_id';

    public static function onBeforeInsert($model)
    {
        $model->set("create_ip", request()->ip());
    }
    public function firm()
    {
        return $this->belongsTo(FirmModel::class)->bind(['firm_name','staff_num','expire_time_date']);
    }
    public function account(){
        return $this->belongsTo(AccountModel::class)->bind(['name','mobile']);
    }
}